package ch.zbw.sysventory.agent;
//import java.util.List;

import ch.zbw.sysventory.transport.model.ScanResult;


public class Agent2 {

	private String printerName;
	private String[] printerNameArray;
	private String printerDriver;
	private String[] printerDriverArray;
	private String printerDriverVersion;
	private String[] printerDriverVersionArray;
	private String installedPrograms;
	private String[] installedProgramsArray;
	private String programVersion;
	private String[] programVersionArray;
	ScanResult scanResult = new ScanResult();
	

	public Agent2() {
		
	}

	public void runAgent() {
		try {

			// Drucker
			printerName = jWMI.getWMIValue("Select * from Win32_Printer", "Name");
			printerNameArray = printerName.split("\r\n");
			printerDriver = jWMI.getWMIValue("Select * from Win32_PrinterDriver", "Name");
			printerDriverArray = printerDriver.split("\r\n");
			printerDriverVersion = jWMI.getWMIValue("Select * from Win32_PrinterDriver", "Version");
			printerDriverVersionArray = printerDriverVersion.split("\r\n");
			
			// Programme
			installedPrograms = jWMI.getWMIValue("Select * from Win32_Product", "Name");
			installedProgramsArray = installedPrograms.split("\r\n");
			programVersion = jWMI.getWMIValue("Select * from Win32_Product", "Version");
			programVersionArray = programVersion.split("\r\n");
			
			//Ausgabe
			//Drucker
			System.out.println("Ausgabe Agent2 :");
			for (int i=0; i<printerNameArray.length; i++){
				System.out.println("Drucker " + (i+1) + ": " + printerNameArray[i] + " Treiber: " + printerDriverArray[i] + " Version: " + printerDriverVersionArray[i]);
			}

			//Programme
			for (int i=0; i<installedProgramsArray.length; i++){
				System.out.println("Prog. " +(i+1) + ": " + installedProgramsArray[i] + "  V" +  programVersionArray[i]);
			}
						
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	public String[] getPrinterNameArray() {
		return printerNameArray;
	}

	public void setPrinterNameArray(String[] printerNameArray) {
		this.printerNameArray = printerNameArray;
	}

	public String[] getInstalledProgramsArray() {
		return installedProgramsArray;
	}

	public void setInstalledProgramsArray(String[] installedProgramsArray) {
		this.installedProgramsArray = installedProgramsArray;
	}
}
